﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
using CopySniffer.UI.Views.WindowsForms.Properties;

namespace CopySniffer.UI.Views.WindowsForms
{
    public partial class BaseDockContent : DockContent
    {
        public BaseDockContent()
        {
            InitializeComponent();
        }

        public void ShowMessage(string message)
        {
            MessageBox.Show(message);
        }

        public void ShowError(string message)
        {
            MessageBox.Show(
                message, 
                Resources.ErrorMessageCaption, 
                MessageBoxButtons.OK, 
                MessageBoxIcon.Error);
        }

        public void ShowWarning(string message)
        {
            MessageBox.Show(
                message, 
                Resources.WarningMessageCaption, 
                MessageBoxButtons.OK, 
                MessageBoxIcon.Warning);
        }

        public void ShowException(Exception exception)
        {
            ShowException(Resources.GeneralExceptionMessageFormat, exception);
        }

        public void ShowException(string messageFormat, Exception exception)
        {
            MessageBox.Show(
                String.Format(
                    messageFormat,
                    exception.Message),
                Resources.ErrorMessageCaption,
                MessageBoxButtons.OK,
                MessageBoxIcon.Stop);
        }

        public bool AskConfirmation(string message)
        {
            return MessageBox.Show(
                message,
                Resources.ConfirmationWindowCaption,
                MessageBoxButtons.OKCancel,
                MessageBoxIcon.Question) == DialogResult.OK;
        }

        public void BeginWaitState()
        {
            this.Cursor = Cursors.WaitCursor;
        }

        public void BeginWaitState(string message)
        {
            this.Cursor = Cursors.WaitCursor;
        }

        public void EndWaitState()
        {
            this.Cursor = Cursors.Default;
        }

        public string ViewTitle
        {
            get { return Text; }
            set
            {
                Text = value;
                TabText = value;
            }
        }
    }
}
